package com.example.backend.controller;

import com.example.backend.service.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@CrossOrigin(origins = "*", maxAge = 3000)
public class DataController {

    @Autowired
    private DataService dataService;

    @GetMapping("/data")
    public Map<String, Object> getData(HttpServletRequest request) {
        return dataService.getUserData(request);
    }
}
